//
//  NSString+StringTosize.m
//  QQ界面
//
//  Created by apple on 16/11/18.
//  Copyright © 2016年 LWB. All rights reserved.
//

#import "NSString+StringTosize.h"

@implementation NSString (StringTosize)
-(CGSize)sizeOfTextWithMaxSize:(CGSize)maxSize font:(UIFont*)font{
    NSDictionary *attrs = @{NSFontAttributeName:font};
    CGSize sz = [self boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:attrs context:nil].size;
    return sz;
}
+(CGSize)sizeWithText:(NSString*)text maxSize:(CGSize)maxSize font:(UIFont*)font{
    return [text sizeOfTextWithMaxSize:maxSize font:font];
}
@end
